<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class checkBrandForm extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|unique:shop_brand|max:50',
            'brandpic' => 'required|image|between:1,1024',
            'content' => 'max:200',
        ];
    }
    /**
     * [messages description]
     * @return [type] [description]
     */
    public function messages()
    {
        return [
            'name.required' => '品牌名不能为空',
            'name.max' => '品牌名最大长度是50个字符',
            'name.unique' => '品牌已存在，无需再添加',
            'brandpic.required' => '必须上传一张品牌的logo',
            'brandpic.image' => '图片格式不正确，请上正确格式的图片',
            'brandpic.between' => '图片大小不能超过1MB',
            'content.max' => '品牌的描述不能超过200个字符'
        ];
    }
}
